/**
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
* This file is a part of the CANN Open Software.
* Licensed under CANN Open Software License Agreement Version 1.0 (the "License").
* Please refer to the License for details. You may not use this file except in compliance with the License.
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
* See LICENSE in the root of the software repository for the full text of the License.
*/

/*!
* \file matmul_entity_macro.h
* \brief
*/
#ifndef IMPL_MATMUL_MODULES_MATMUL_ENTITY_MACRO_H
#define IMPL_MATMUL_MODULES_MATMUL_ENTITY_MACRO_H

#define MATMUL_ENTITY ENTITY

#define MATMUL_ENTITY_IMPL_TYPE MatmulImpl<A_TYPE, B_TYPE, C_TYPE, BIAS_TYPE, MM_CFG, MM_CB>

#define MATMUL_IMPORT_MODULE(NAME, ...) private NAME<MATMUL_ENTITY_IMPL_TYPE, ##__VA_ARGS__>

#define MATMUL_MODULE_NAME(NAME)  NAME##Module

#define MATMUL_USE_MODULE_OF(NAME, ENTITY, ...) using MATMUL_MODULE_NAME(NAME) = NAME<ENTITY, ##__VA_ARGS__>
#define MATMUL_USE_MODULE(NAME, ...)  MATMUL_USE_MODULE_OF(NAME, MATMUL_ENTITY, ##__VA_ARGS__)

#define MATMUL_USE_IMPORTED_MODULE(NAME, ...)                           \
MATMUL_USE_MODULE_OF(NAME, MATMUL_ENTITY_IMPL_TYPE, ##__VA_ARGS__);     \
friend class NAME<MATMUL_ENTITY_IMPL_TYPE, ##__VA_ARGS__>

#define MATMUL_PARAMS_OF(ENTITY) static_cast<ENTITY*>(this)->var
#define MATMUL_PARAM_VAR         MATMUL_PARAMS_OF(MATMUL_ENTITY)

#define MATMUL_CONST_PARAMS_OF(ENTITY) ((const ENTITY*)(this))->var
#define MATMUL_CONST_PARAM_VAR         MATMUL_CONST_PARAMS_OF(MATMUL_ENTITY)

#define MATMUL_MODULE(NAME) (*static_cast<MATMUL_MODULE_NAME(NAME)*>(static_cast<MATMUL_ENTITY*>(this)))

#endif // _MATMUL_ENTITY_MACRO_H_